$('.footer .header_ ul li:nth-child(1)').click(function(){
	window.location.href = "index.html"
})
$('.footer .header_ ul li:nth-child(2)').click(function(){
	window.location.href = "Brand.html"
})
$('.footer .header_ ul li:nth-child(3)').click(function(){
	window.location.href = "Selling.html"
})
$('.footer .header_ ul li:nth-child(4)').click(function(){
window.location.href = "Point.html"
})
$('.footer .header_ ul li:nth-child(5)').click(function(){
	window.location.href = "Investment.html"
})
$('.footer .header_ ul li:nth-child(6)').click(function(){
	window.location.href = "Company.html"
})
$('.footer .header_ ul li:nth-child(7)').click(function(){
	window.location.href = "Contact-us.html"
})

$('.imgs').click(function(){
	window.location.href = "index.html"
})
var target = -200;
		var winH = window.innerHeight; //屏幕的高度
		$(".load").on("load", function() {
			$(this).css("transform", "scale(1)");
			//$(this).addClass('active')
		})
		$(document).on("scroll", function() {
			var scrollT = $(this).scrollTop(); //滚动距离
			console.log(scrollT);
			$(".load").each(function(index, val) {
				var offsetT = $(this).offset().top;

				if(offsetT - scrollT - winH < target) {
					$(this).parents('.page').addClass('active');
					var imgSrc = $(this).attr('data-src');
					$(this).attr('src', imgSrc);
				}
			})
		})

//重置
$('#reset').click(function() {
	$(".user_name").val('');
	$(".mobile_Val").val('');
	$(".leave_msg").val('');
})
//提交
$('#submit').click(function() {
	Submit_msg();
})

function Submit_msg() {
	var user_name = $(".user_name").val();
	var mobile_Val = $(".mobile_Val").val();
	var leave_msg = $(".leave_msg").val();
	var regName = /^[ \u4e00-\u9fa5A-Za-z]+$/;
	var regTel = /^1[1-9]\d{9}$/;
	if(!regName.test(user_name)) {
		layer.msg('输入名字不合法', {
			icon: 2,
			time: 1500
		});
		return false;
	}
	if(!regTel.test(mobile_Val)) {
		layer.msg('请输入正确手机号', {
			icon: 2,
			time: 1500
		});
		return false;
	}
	if(leave_msg == "") {
		layer.msg('留言不能为空', {
			icon: 2,
			time: 1500
		});
		return false;
	}
	$.ajax({
		type: "get",
		url: "http://wl.xiyuankj.com/index.php/Home/Public/addGo",
		dataType: "jsonp",
		data: {
			username: user_name,
			tel: mobile_Val,
			con: leave_msg
		},
		jsonp: "callback",
		success: function(res) {
			console.log(res.status);
			if(res['status'] == 1) {
				alert("提交成功");
			};
			return false;
		},
		error: function(res) {
			alert("提交失败");
		}
	});
}


//联系合作提交申请、
$('.bth_apply').click(function() {
	get_apply();
})

var url_ = window.location.href;
function get_apply() {
	var user_name = $(".user_name").val();
	var mobile_Val = $(".mobile_Val").val();
	var address_msg = $(".address_msg").val();
	var leave_msg = $(".leave_msg").val();
	var regName = /^[ \u4e00-\u9fa5A-Za-z]+$/;
	var regTel = /^1[3-8]\d{9}$/;
	var xm = "鲜动力_pc";
	if(!regName.test(user_name)) {
		layer.msg('输入名字不合法', {
			icon: 2,
			time: 1500
		});
		return false;
	}
	if(!regTel.test(mobile_Val)) {
		layer.msg('请输入正确手机号', {
			icon: 2,
			time: 1500
		});
		return false;
	}
	if(address_msg == "") {
		layer.msg('地址不能为空', {
			icon: 2,
			time: 1500
		});
		return false;
	}
	if(leave_msg == "") {
		layer.msg('留言不能为空', {
			icon: 2,
			time: 1500
		});
		return false;
	}
	$.ajax({
		type: "get",
		url: "http://wl.xiyuankj.com/index.php/Home/Public/addGo",
		dataType: "jsonp",
		data: {
			url: url_,
			username: user_name,
			xm: xm,
			tel: mobile_Val,
			con: leave_msg
		},
		jsonp: "callback",
		success: function(res) {
			console.log(res.status);
			if(res['status'] == 1) {
				alert("提交成功");
			};
			if(res['status'] == 0) {
				alert("提交失败");
			};
		},
		error: function(res) {
			alert("提交失败");
		}
	});
}